package com.ubxtech.mqtt.config;

import com.ubxtech.mqtt.handler.AbstractReceiveMessageHandler;
import com.ubxtech.mqtt.handler.ReceiveMessageDefaultHandler;
import com.ubxtech.mqtt.service.MqttTopicService;
import com.ubxtech.mqtt.service.impl.MqttTopicServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.annotation.IntegrationComponentScan;

/**
 * @author Victor.Xiao
 * @since 2022-11-10 10:42
 **/
@IntegrationComponentScan(basePackages = {"com.ubxtech"})
@Configuration
public class MqttOperationServiceConfig {

    @Bean
    @ConditionalOnMissingBean
    public MqttTopicService mqttTopicService() {
        return new MqttTopicServiceImpl();
    }

    @Bean
    @ConditionalOnMissingBean
    public AbstractReceiveMessageHandler abstractReceiveMessageHandler() {
        return new ReceiveMessageDefaultHandler();
    }

}
